package com.itheima.d2_upd1.ZengUdpTest;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

/**
 * @ClassName Server
 * @Author 16799
 * @Date 2025/9/24 23:21
 * @Version 1.0
 * @Description TODO
 **/
public class Server {
    public static void main(String[] args) throws Exception {
        System.out.println("--服务端启动--");
        DatagramSocket socket = new DatagramSocket(7722);

        byte[] buffer = new byte[1024*64];
        DatagramPacket packet = new DatagramPacket(buffer,buffer.length);

        socket.receive(packet);

        int len = packet.getLength();
        String rs = new String(buffer,0,len);
        System.out.println(rs);
    }
}
